<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Insert title here</title>
<link
	href="${pageContext.request.contextPath}/static/bootstrap4/css/bootstrap.min.css"
	rel="stylesheet">
<link
	href="${pageContext.request.contextPath}/static/plugins/bootstrap-table/bootstrap-table.min.css"
	rel="stylesheet">

<link rel="stylesheet" href="${pageContext.request.contextPath}/static/plugins/jstree/dist/themes/default/style.min.css" />
</head>
<body>
	
	<div class="container">
			<div>${currentUser.userName}</div>
			<!-- 显示权限 -->
			<div class="well well-sm" style="margin:0px auto;width:1200px">
				<div style="width:200px;float:left">
					<div id="authsThree"></div>
				</div>
				<div id="xtkjContent" style="width:1000px;float:right">
					
				</div>
			</div>
	</div>
</body>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/static/plugins/jQuery/jquery-3.1.0.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/plugins/jstree/dist/jstree.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/static/plugins/popper/popper.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/static/bootstrap4/js/bootstrap.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/static/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/static/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>

<script type="text/javascript">
	$(function(){
		
		$.ajax({
			url : '${pageContext.request.contextPath}/auth/currauths',
			dataType:'json',
			type:'post',
			success:function(data){
				console.log(data);
				var json = new Array();
				for(i=0;i<data.result.length;i++){
					var pt = data.result[i].authParentId;
					json.push({"id":data.result[i].authId,"text":data.result[i].authName,"parent":pt==0?"#":pt,a_attr:{"href":data.result[i].authUrl}});
				}
				console.log(json);
				$('#authsThree').jstree({
					'core' : {
						'data' : json
					}
				});
			}
		});
		
		
		
		$('#authsThree').on("changed.jstree",function(e,data){
			console.log(data);
			var url  = data.node.a_attr.href;
			if(url!="")
			{
				//emplist.jsp
				loadPage(url);
			}
		});
		
		
	
	});
	
	
	function loadPage(path){
		var url = path+"?time="+new Date().getTime();
		console.log(url);
		$.ajax({
			url : url,
			success:function(data){
				console.log(data);
				$("#xtkjContent").html(data);
			}
		});
	}
</script>
</html>















